<div class="modal-dialog modal-md">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button"
                    class="close"
                    data-dismiss="modal"
                    aria-label="Close"
                    ng-click="closeThisDialog()" style="outline: none;"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title">
                <span>新增库存</span>
            </h4>
        </div>
        <div class="modal-body">
            <label for="name">使用物料名称搜索:</label>
            <input type="text"
                   id="name"
                   class="form-control"
                   ng-model="filters.name"
                   placeholder="物料名称"
                   aria-describedby="sizing-addon2">
        </div>
        <form ng-submit="saveProduct(product)">
            <div class="modal-body table-responsive">
                <table ng-table="productTable" show-filter="false" class="table table-striped">
                    <tr ng-repeat="(index,product) in $data">
                        <td data-title="'#'">
                            <span class="editable-text" ng-bind="product.id"></span>
                        </td>
                        <td data-title="'物料名称'">
                            <span class="editable-text" ng-bind="product.name"></span>
                        </td>
                        <td width="150" data-title="'分类'">
                            <span class="editable-text" ng-bind="product.category.name"></span>
                        </td>
                        <td data-title="'物料单位'">
                            <span class="editable-text" ng-bind="product.unit"></span>
                        </td>
                        <td data-title="'操作'">
                            <button class="btn btn-primary btn-sm"
                                    title="选择"
                                    type="button"
                                    ng-click="setProduct(product)"
                                    data-toggle="tooltip">
                                <span class="glyphicon glyphicon-ok"></span>
                            </button>
                        </td>
                    </tr>
                    <tr ng-show="!$data.length">
                        <td colspan="10" class="text-center">物料库中没有可添加的物料, <a>物料管理</a>中可新增物料</td>
                    </tr>
                </table>
                <hr>
                <div ng-show="product">
                    <div class="form-group">
                        <label class="control-label">物料名称</label>
                        <span type="text"
                              class="form-control disabled"
                              ng-bind="product.name" readonly=""></span>
                        <span ng-show="error.sku_id" class="label label-danger" ng-bind="error.sku_id"></span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">物料分类</label>
                        <span type="text"
                              class="form-control disabled"
                              ng-bind="product.category.name" readonly=""></span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">物料单位</label>
                        <span type="text"
                              class="form-control"
                              ng-bind="product.unit" readonly=""></span>
                    </div>
                    <div class="form-group">
                        <label for="product-new-price" class="control-label">单位价格 (元)</label>
                        <input ng-focus="error.price=''"
                               class="form-control"
                               ng-model="product.price"
                               id="product-new-price"
                               placeholder="单位价格 (元)"/>
                        <span ng-show="error.price" class="label label-danger" ng-bind="error.price"></span>
                        <span ng-show="error.type" class="label label-danger" ng-bind="error.type"></span>
                    </div>
                    <div class="form-group">
                        <label for="product-new-quantity" class="control-label">进库量</label>
                        <input ng-focus="error.quantity=''"
                               class="form-control"
                               ng-model="product.quantity"
                               id="product-new-quantity"
                               rows="5"
                               placeholder="请输入进库量"/>
                        <span ng-show="error.quantity" class="label label-danger" ng-bind="error.quantity"></span>
                    </div>
                    <div class="form-group">
                        <label for="product-new-notes" class="control-label">备注信息</label>
                        <textarea ng-focus="error.notes=''"
                                  class="form-control"
                                  ng-model="product.notes"
                                  id="product-new-notes"
                                  rows="5"
                                  placeholder="备注信息"></textarea>
                        <span ng-show="error.notes" class="label label-danger" ng-bind="error.notes"></span>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary">保存</button>
            </div>
        </form>
    </div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->